package com.wallace.downloadserver.service.impl

import com.wallace.downloadserver.bean.MyInterface
import com.wallace.downloadserver.mapper.MyInterfaceMapper
import com.wallace.downloadserver.service.MyInterfaceService
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service

/**
 * @Description:
 * MyInterfaceServiceImpl
 * @author Wallace
 * @Date 2022/1/28 15:54
 */
@Service
class MyInterfaceServiceImpl : MyInterfaceService {

    private val log: Logger = LoggerFactory.getLogger(javaClass)

    @Autowired
    private lateinit var myInterfaceMapper: MyInterfaceMapper

    override fun deleteByPrimaryKey(id: Int?): Int {
        return myInterfaceMapper.deleteByPrimaryKey(id)
    }

    override fun deleteAll(): Int {
        return myInterfaceMapper.deleteAll()
    }

    override fun insert(record: MyInterface?): Int {
        return if (record != null) {
            myInterfaceMapper.insert(record)
        } else {
            0
        }
    }

    override fun insertSelective(record: MyInterface?): Int {
        return myInterfaceMapper.insertSelective(record)
    }

    override fun selectByPrimaryKey(id: Int?): MyInterface? {
        return if (id != null) {
            myInterfaceMapper.selectByPrimaryKey(id)
        } else {
            null
        }
    }

    override fun selectMethodName(methodName: String?): MyInterface? {
        return if (methodName != null) {
            myInterfaceMapper.selectMethodName(methodName)
        } else {
            null
        }
    }

    override fun updateByPrimaryKeySelective(record: MyInterface?): Int {
        return myInterfaceMapper.updateByPrimaryKeySelective(record)
    }

    override fun updateByPrimaryKey(record: MyInterface?): Int {
        return myInterfaceMapper.updateByPrimaryKey(record)
    }
}